<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>时间</title>
    <style>
        #time {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 500px;
            width: 800px;
            background-color: black;
            color: white;
            margin: 100px auto;
            font-size: 150px;
            border-radius: 50px;
        }
    </style>
</head>

<body>
    <div id="time"></div>
    <script>
        let timeEle = document.getElementById('time')
        

        function fillZero(num) {
            return num > 10 ? num : '0' + num
        }
        setInterval(function () {
            let date = new Date()
            let hours = date.getHours()
            let minutes = date.getMinutes()
            let seconds = date.getSeconds()

            let dateTime = fillZero(hours) + ':' + fillZero(minutes) + ':' + fillZero(seconds)
            timeEle.innerText = dateTime
        }, 1000)
    </script>
</body>

</html>